<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Shop.Master" Inherits="Shop.Framework.Page.CartItemsPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <title>Cart Items</title>
    <style type="text/css">
        #orderList
        {
            list-style: none;
            margin: 0;
            padding: 0;
            height: auto;
        }
        #orderList li
        {
            padding: 10px;
            width: 350px;
            height: auto;
        }
        #orderList li form
        {
            background-color: #EBF2E1;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
    <div style="padding: 40px;">
        <a class="nav_link" onclick="history.go(-1)">Back to previous</a>
        <br />
        <h2>
            Your Orders</h2>
        <%if (OrderItems.Count == 0) { %>
        <br />
        <h3>
            You have no items in your cart</h3>
        <%} else {%>
        <ul id="orderList">
            <%foreach (var t in OrderItems) { %>
            <li>
                <form action="/cart/delete/<%=t.IdProduct %>" method="post">
                    <%if (t.Product.ProductImages.Count == 0) { %>
                    <h2>No image available</h2>
                    <%} else { %>
                    <img src="/productimages/<%=t.Product.ProductImages.FirstOrDefault(x => x.IsDefault).Name %>"
                        alt="image" height="150px;" style="padding:5px;" />
                    <%} %>
                    <h5><%=t.Name %></h5>
                    <h5>Price: <%=t.TaxedPrice.ToString("C") %></h5>
                    Quantity:<input name="quantity" id="quantity" type="text" value="<%=t.Quantity %>"
                        style="width: 40px; padding-left: 10px;" />
                    <input name="modify" type="submit" value="Set changes" />
                    <input name="delete" type="submit" value="Delete item" />
                </form>
            </li>
            <%} %>
        </ul>
        <div class="clear"></div>
        <h3>Total Amount: <%=TotalAmmount.ToString("C") %></h3>
        
        <br/>
        <a href="/checkout" class="nav_link"><b>Proceed to payment..</b></a>
        <%} %>
        
        <br/>
        <br/>
        <br/>
        <a class="nav_link" onclick="history.go(-1)">Back to previous</a>
        <br />
    </div>    
    
</asp:Content>
